package practica.arboles;

import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTree;

import org.antlr.runtime.tree.CommonTree;

/**
 * @author Jorg Werner
 */
public class ASTFrame extends JFrame {

        private static final long serialVersionUID = -92059391014955313L;

        public ASTFrame(String lab, CommonTree t) {
                super(lab);

                JTree tree = new JTree(new ASTToTreeModelAdapter(t));

                JScrollPane scrollPane = new JScrollPane(tree);

                JPanel panel = new JPanel();
                panel.setLayout(new BorderLayout());
                panel.add(scrollPane);

                Container content = getContentPane();
                content.add(panel, BorderLayout.CENTER);
                
                setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                setResizable(false);
                setSize(640, 480);

                setLocationRelativeTo(null);
        }
}